﻿// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)

// Unlit shader. Simplest possible textured shader.
// - no lighting
// - no lightmap support
// - no per-material color

Shader "Unlit/DoubleTexture" {
Properties {
	_MainTex0 ("Base (RGB)", 2D) = "white" {}
	_MainTex1 ("Base (RGB)", 2D) = "white" {}
    _MainTex0Proportion ("MainTex0Proportion", Range (0,1.0)) = 1.0
    _MainTex1Proportion ("MainTex1Proportion", Range (0,1.0)) = 0.0
}

SubShader {
	Tags { "RenderType"="Opaque" }
	
	Pass {  
		CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			#pragma target 2.0
			#pragma multi_compile_fog
			
			#include "UnityCG.cginc"

			struct appdata_t {
				float4 vertex : POSITION;
				float2 texcoord : TEXCOORD0;
			};

			struct v2f {
				float4 vertex : SV_POSITION;
				float2 texcoord0 : TEXCOORD0;
				float2 texcoord1 : TEXCOORD1;
			};

			sampler2D _MainTex0;
			float4 _MainTex0_ST;
			
			sampler2D _MainTex1;
			float4 _MainTex1_ST;

            float _MainTex0Proportion;
            float _MainTex1Proportion;


			v2f vert (appdata_t v)
			{
				v2f o;
				o.vertex = UnityObjectToClipPos(v.vertex);
				o.texcoord0 = TRANSFORM_TEX(v.texcoord, _MainTex0);
				o.texcoord1 = TRANSFORM_TEX(v.texcoord, _MainTex1);

				return o;
			}
			
			fixed4 frag (v2f i) : SV_Target
			{
				fixed4 col0 = tex2D(_MainTex0, i.texcoord0);
				fixed4 col1 = tex2D(_MainTex1, i.texcoord1);
                fixed4 col = col0 * _MainTex0Proportion + col1 * _MainTex1Proportion ;
				UNITY_OPAQUE_ALPHA(col.a);
				return col;
			}
		ENDCG
	}
}

}
